import httpRequest from '@/utils/request'

// 查询聊天数据列表
export function list(query) {
	return httpRequest.request({
		url: '/market/chat/list',
		method: 'get',
		params: query
	})
}

// 查询最近和自己聊天的用户
export function listChatUserVo(page) {
	return httpRequest.request({
		url: `/market/chat/listChatUserVo?pageNum=${page.pageNum}&pageSize=${page.pageSize}`,
		method: 'get'
	})
}

// 查询用户和自己最近的聊天信息
export function listChat(toUsername, page) {
	return httpRequest.request({
		url: `/market/chat/listChat/${toUsername}?pageNum=${page.pageNum}&pageSize=${page.pageSize}`,
		method: 'get'
	})
}


// 查询聊天数据详细
export function getChat(id) {
	return httpRequest.request({
		url: '/market/chat/getInfo/' + id,
		method: 'get'
	})
}

// 新增聊天数据
export function addChat(data) {
	return httpRequest.request({
		url: '/market/chat',
		method: 'post',
		data: data
	})
}

// 修改聊天数据
export function updateChat(data) {
	return httpRequest.request({
		url: '/market/chat',
		method: 'put',
		data: data
	})
}

// 删除聊天数据
export function delChat(id) {
	return httpRequest.request({
		url: '/market/chat/' + id,
		method: 'delete'
	})
}